/**
 * Created by wry on 2014/12/11.
 */

module.exports = function (app) {
    var question = require('../controllers/question-controller');

    //提问相关
    app.post('/rest/' + RESTFullServiceVersion + '/Questions/postQuestionNew/:token/:deviceId', question.postQuestionNew);
    app.post('/rest/' + RESTFullServiceVersion + '/Questions/postQuestion/:token/:deviceId', question.postQuestion);
    app.post('/rest/' + RESTFullServiceVersion + '/Questions/uploadQuestionImages/:questionId/:token/:deviceId', question.uploadQuestionImages);
    app.put('/rest/' + RESTFullServiceVersion + '/Questions/updateQuestion/:questionId/:token/:deviceId', question.updateQuestion);
    app.post('/rest/' + RESTFullServiceVersion + '/Questions/deleteQuestion/:questionId/:delDesc', question.deleteQuestion);
    app.post('/rest/' + RESTFullServiceVersion + '/Questions/deleteQuestionByModerator', question.deleteQuestionByModerator);
    app.delete('/rest/' + RESTFullServiceVersion + '/Questions/deleteQuestionImages/:questionId/:token/:deviceId', question.deleteQuestionImages);
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/reportQuestion/:questionId/:token/:deviceId', question.reportQuestion);

    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getDetailOfQuestion/:questionId/:token/:deviceId', question.getDetailOfQuestion);  // 2015-10-21
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getDetailReplyOfQuestion/:questionId/:page/:token/:deviceId', question.getDetailReplyOfQuestion); // 2015-10-21

    //回复相关
    app.post('/rest/' + RESTFullServiceVersion + '/Questions/postReply/:questionId/:token/:deviceId', question.postReply);
    app.post('/rest/' + RESTFullServiceVersion + '/Questions/postReplyNew/:questionId/:token/:deviceId', question.postReplyNew);

    app.post('/rest/' + RESTFullServiceVersion + '/Questions/uploadReplyImages/:questionId/:replyId/:token/:deviceId', question.uploadReplyImages);
    app.put('/rest/' + RESTFullServiceVersion + '/Questions/updateReply/:questionId/:replyId/:token/:deviceId', question.updateReply);
    app.delete('/rest/' + RESTFullServiceVersion + '/Questions/deleteReply/:questionId/:replyId/:token/:deviceId', question.deleteReply);
    app.delete('/rest/' + RESTFullServiceVersion + '/Questions/deleteReplyImages/:questionId/:replyId/:token/:deviceId', question.deleteReplyImages);
    app.post('/rest/' + RESTFullServiceVersion + '/Questions/adoptReply/:questionId/:replyId/:token/:deviceId', question.adoptReply);

    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getCommunityQuestionAndReplyCount/:tagId/:token/:deviceId', question.getCommunityQuestionAndReplyCount);
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getCategoryQuestionCount/:category/:token/:deviceId', question.getCategoryQuestionCount);

    app.get('/rest/' + RESTFullServiceVersion + '/Questions/thankReply/:questionId/:replyId/:replyBy/:token/:deviceId', question.thankReply);

    //投票相关
    app.post('/rest/' + RESTFullServiceVersion + '/Questions/createPoll/:token/:deviceId', question.createPoll);
    app.put('/rest/' + RESTFullServiceVersion + '/Questions/updatePoll/:pollId/:token/:deviceId', question.updatePoll);
    app.post('/rest/' + RESTFullServiceVersion + '/Questions/uploadPollImages/:pollId/:token/:deviceId', question.uploadPollImages);
    app.delete('/rest/' + RESTFullServiceVersion + '/Questions/deletePoll/:pollId/:token/:deviceId', question.deletePoll);
    app.post('/rest/' + RESTFullServiceVersion + '/Questions/doPoll/:pollId/:token/:deviceId', question.doPoll);
    app.post('/rest/' + RESTFullServiceVersion + '/Questions/closePoll/:pollId/:token/:deviceId', question.closePoll);

    //获取我的问题、投票、回复、问题详情
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getMyQuestionAndPollList/:pageNo/:token/:deviceId', question.getMyQuestionAndPollList);
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getMyRepliedQuestionList/:pageNo/:token/:deviceId', question.getMyRepliedQuestionList);

    //新版（我的发布和回复）
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getMyQuestionList/:pageNo/:token/:deviceId', question.getMyQuestionList);
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getMyReplyList/:pageNo/:token/:deviceId', question.getMyReplyList);


    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getDetailOfQuestionOrPoll/:questionOrPollId/:token/:deviceId', question.getDetailOfQuestionOrPoll);
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/praiseReplyService/:replyId/:replyBy/:token/:deviceId', question.praiseReplyService);

    //问题或投票、回复置顶

    app.put('/rest/' + RESTFullServiceVersion + '/Questions/moveReplyToTop/:questionId/:replyId/:token/:deviceId', question.moveReplyToTop);

    //推荐、分类、搜索、专家回复
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getRecommendedQuestionAndPollList/:token/:deviceId', question.getRecommendedQuestionAndPollList);
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getCategorizedQuestionAndPollList/:pageNo/:tagId/:token/:deviceId', question.getCategorizedQuestionAndPollList);
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/searchQuestionAndPollList/:keyword/:token/:deviceId', question.searchQuestionAndPollList);
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getExpertRepliedQuestionList/:pageNo/:token/:deviceId', question.getExpertRepliedQuestionList);

    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getTalentList/:tagId/:token/:deviceId', question.getTalentList);

    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getAllCommunityQuestionList/:pageNo/:token/:deviceId', question.getAllCommunityQuestionList);

    //新接口
    <!--  宝宝树66小区二次改造    mod   gct  20170808   start   -->
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getAllCommunityQuestionListNew/:ts/:token/:flag/:communityId/:deviceId', question.getAllCommunityQuestionListNew); // 2015-10-21
    <!--  宝宝树66小区二次改造    mod   gct  20170808   end   -->
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getQuestionListByTag/:ts/:tagId/:token/:deviceId', question.getQuestionListByTag);

    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getAllCommunityPollList/:pageNo/:token/:deviceId', question.getAllCommunityPollList);
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getAllCommunitySpecialTopicList/:pageNo/:token/:deviceId', question.getAllCommunitySpecialTopicList);

    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getLatestQuestionList/:pageNo/:token/:deviceId', question.getLatestQuestionList);

    //=================新版求助========================
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getCategoryQuestionList/:category/:pageNo/:token/:deviceId', question.getCategoryQuestionList);
    <!--  宝宝树66小区二次改造    mod   gct  20170808   start   -->
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getCategoryQuestionListNew/:category/:ts/:token/:flag/:communityId/:deviceId', question.getCategoryQuestionListNew); // 2015-10-20
    <!--  宝宝树66小区二次改造    mod   gct  20170808   end   -->
    <!--  宝宝树66小区二次改造    add   gct  20170807   start   -->
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getCommunityAll/:token', question.getCommunityAll); // 2015-10-20
    app.get('/rest/' + RESTFullServiceVersion + '/Questions/getCommunityByUserID/:token', question.getCommunityByUserID); // 2015-10-20
    <!--  宝宝树66小区二次改造    add   gct  20170807   end   -->
    //后台管理问答路由
    //app.post('/rest/' + RESTFullServiceVersion + '/backoffice/admin/createQuestion', question.createQuestion);
    app.put('/rest/' + RESTFullServiceVersion + '/backoffice/admin/backOfficeUpdateQuestion/:objId', question.backOfficeUpdateQuestion);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/admin/backOfficeUpdateQuestionByModerator/:objId', question.backOfficeUpdateQuestionByModerator);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/admin/getQuestionById/:objId', question.getQuestionById);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/admin/getQuestionList', question.getQuestionList);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/admin/searchQuestion', question.searchQuestion);
    app.delete('/rest/' + RESTFullServiceVersion + '/backoffice/admin/deleteQuestion/:objId', question.deleteOneQuestion);
    app.put('/rest/' + RESTFullServiceVersion + '/backoffice/admin/changeQuestionOrder/:objId', question.changeQuestionOrder);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/admin/getReplyList/:questionOrPollId/:token', question.getReplyList);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/admin/searchReply', question.searchReply);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/admin/deleteReply', question.deleteReplyByPost);

    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/admin/getNoReplyQuestionList/:objId', question.getNoReplyQuestionList);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/admin/backOfficePostReply/:objId', question.backOfficePostReply);

    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/question/getReportQuestion/:communityId', question.getReportQuestion);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/question/deleteReportQuestion/:questionId', question.deleteReportQuestion)
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/question/getRecommendQuestion/:page/:size', question.getRecommendQuestion);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/question/recommendQuestion/:questionId/:flag', question.recommendQuestion);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/question/getFreshNewsQuestion', question.getFreshNewsQuestion);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/question/addQuestionToFreshNews', question.addQuestionToFreshNews);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/question/exportQuestionList/:page/:size', question.exportQuestionList);  // 导出

    //根据userId搜索用户发布问题和回复
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/question/searchUserQuestion/:userId', question.searchUserQuestion);

    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/question/moveQuestionToTop', question.moveQuestionToTop); // 2015-10-21  置顶
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/question/cancelTopQuestion', question.cancelTopQuestion); // 2015-10-21  取消置顶
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/question/pushQuestionByTag', question.pushQuestionByTag);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/question/confirmPushQuestion', question.confirmPushQuestion);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/question/changeQuestionCategory/:questionId/:category', question.changeQuestionCategory);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/question/changeQuestionLevel', question.changeQuestionLevel);

    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/question/getQuestionByFilter', question.getQuestionByFilter);
};